<!--
 * @Author: wusd
 * @Date: 2023-02-13 16:31:27
 * @LastEditors: wusd
 * @LastEditTime: 2024-11-08 16:52:38
 * @Description: 
 * 
-->
<template>
  <div class="W_SumColumn">
    {{ value }}
  </div>
</template>

<script>
import { arrSum } from '@/untils/index'

export default {
  props: {
    value: {
      type: [String, Number],
      default: ''
    },
    config_: {
      type: Object,
      default: () => {
        return {}
      }
    },
    sumList: {
      /**求和需要的项 */
      type: Array,
      default: () => []
    },
    //计算错误是的展示值
    errorTxt: {
      type: [String, Number],
      default: '-'
    }
  },
  data() {
    return {
      text: ''
    }
  },
  watch: {
    config_: {
      deep: true,
      immediate: true,
      handler: function () {
        this.$emit(
          'input',
          arrSum(
            this.sumList?.map(item => this.config_.row[item]),
            this.errorTxt
          ) + ''
        )
        this.$forceUpdate()
      }
    }
  },
  methods: {}
}
</script>

<style></style>
